package com.shop.cloud.mall.admin.controller;

import com.getui.push.v2.sdk.common.ApiResult;
import com.getui.push.v2.sdk.dto.req.CidAliasListDTO;
import com.shop.cloud.common.getui.utils.GeTuiUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 * @date 2018/11/14
 * <p>
 * 个推控制类
 */
@RestController
@AllArgsConstructor
@RequestMapping("/getui")
@Tag(description = "getui", name = "个推API")
public class GeTuiController {
	private final GeTuiUtil geTuiUtil;

	/**
	 * 根据cid查询别名
	 * @return
	 */
	@Operation(summary = "根据cid查询别名")
	@GetMapping("/alias/{cid}")
	public ApiResult queryAliasByCid(@PathVariable("cid") String cid) {
		return geTuiUtil.queryAliasByCid(cid);
	}

	/**
     * 绑定别名
	 * @param cidAliasListDTO
     * @return
	 */
	@Operation(summary = "绑定别名")
	@PostMapping("/alias/bind")
	public ApiResult bindAlias(@RequestBody CidAliasListDTO cidAliasListDTO) {
		return geTuiUtil.bindAlias(cidAliasListDTO);
	}
}
